package com.fausto.learnimprint.config

import org.springframework.boot.web.server.ErrorPage
import org.springframework.boot.web.server.ErrorPageRegistrar
import org.springframework.boot.web.server.ErrorPageRegistry
import org.springframework.context.annotation.Configuration
import org.springframework.http.HttpStatus

@Configuration
class ErrorConfig : ErrorPageRegistrar {
    /**
     * 有匹配的路径，但是该路径下的资源不存在
     *
     * @param registry
     */
    override fun registerErrorPages(registry: ErrorPageRegistry) {
        registry.addErrorPages(ErrorPage(HttpStatus.NOT_FOUND, "/notfound"))
    }
}